package com.qingcloud.fexecutor.base.enums;

/**
 * 服务节点分类枚举.
 */
public enum DeployServiceCategoryEnum {

    INDUSTRY(1, "行业应用", "&#xe7ea;"),
    COMPONENT(2, "服务组件", "&#xe7f5;"),
    UTILS(3, "常用工具", "&#xe7f4;"),
    OTHER(4, "其他", "&#xe631;");

    public final Integer code;
    public final String name;
    public final String icon;

    DeployServiceCategoryEnum(int code, String name, String icon) {
        this.code = code;
        this.name = name;
        this.icon = icon;
    }

    public static String getNameByCode(Integer code) {
        for (DeployServiceCategoryEnum type : DeployServiceCategoryEnum.values()) {
            if (code.equals(type.code)) {
                return type.name;
            }
        }
        return "";
    }

    public static DeployServiceCategoryEnum findByName(String name) {
        for (DeployServiceCategoryEnum type : DeployServiceCategoryEnum.values()) {
            if (type.name().equalsIgnoreCase(name)) {
                return type;
            }
        }
        return null;
    }

}
